package com.auxgroup.hr.front.service.personnal.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import com.auxgroup.hr.front.dao.domain.PsBankEcTbl;
import com.auxgroup.hr.front.dao.repository.PsBankEcTblRepository;
import com.auxgroup.hr.front.service.personnal.BankEcTblService;

/** 
 * @author wangchangyun
 * @version 创建时间：180527 
 * 社保公积金service
 */
@Service("bankEcTblService")
public class BankEcTblServiceImpl implements BankEcTblService {
	
	@Autowired
	private PsBankEcTblRepository PsBankEcTblRepository;


	@Override
	@Cacheable(value="BANKEC_VALUE",key="#bankCd")
	public PsBankEcTbl getBankEcTbl(String bankCd) {
		PsBankEcTbl BankEcTbl = new PsBankEcTbl();
		BankEcTbl.setEffStatus("A");
		BankEcTbl.setBankCd(bankCd);
		List<PsBankEcTbl> BankEcs = PsBankEcTblRepository.findAll(Example.of(BankEcTbl));
		if(BankEcs!=null&&!BankEcs.isEmpty()){
			return BankEcs.get(0);
		}
		return null;
	}
	
	
	@Override
	@Cacheable(value="BANKEC_LIST")
	public List<PsBankEcTbl> getAll() {
		PsBankEcTbl BankEcTbl = new PsBankEcTbl();
		BankEcTbl.setEffStatus("A");
		return PsBankEcTblRepository.findAll(Example.of(BankEcTbl));
	}


	
	
	
}
